﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kardex_DataAccess;
using Kardex_Entity;

namespace Kardex_BussinesLogic
{
    public class ClientFactory
    {
        ClientDA manager;
        public ClientFactory()
        {
            manager = new ClientDA();
        }

        public List<person> GetListClients()
        {
            List<person> listManager = new List<person>();
            listManager = null;
            try
            {
                listManager = manager.GetListClient();
            }
            catch (Exception)
            {

                listManager = null;
            }
            return listManager;
        }
        public person GetObjByIdperson(int Idperson)
        {
            return manager.GetObjByIdperson(Idperson);
        }
        public person Save(person objPerson)
        {
            try
            {
                return manager.Save(objPerson);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }

        public bool Update(person objPerson)
        {
            try
            {
                return manager.Udate(objPerson);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }

        public bool Delete(person objPerson)
        {
            try
            {
                return manager.Delete(objPerson);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message.ToString());
            }
        }
    }
}
